class NeuronConnexion:
    """This class simulates axons and synapses. These are links between neurons
        This class is called by Neuron class and NeuralNetwork class"""
    def __init__(self,parentNeuron,childNeuron):
        self.parentNeuron=parentNeuron
        self.childNeuron=childNeuron
        self.coefficient=1
        self.ready=False
        self.parentNeuron.addChild(self)
        self.childNeuron.addParent(self)

    def propagate(self,input):
        self.signal=input*self.coefficient
        self.ready=True
        self.childNeuron.computeOutput()

    def setCoefficient(self,coeff):
        self.coefficient=coeff

    def getCoefficient(self):
        return self.coefficient

    def getPrcdNeuron(self):
        """Deprecated, use getParentNeuron()"""
        return self.parentNeuron

    def getNextNeuron(self):
        """Deprecated, use getChildNeuron()"""
        return self.childNeuron

    def getPrcdOutput(self):
        """Deprecated, not to be used anymore outputs are pushed
never retrieved"""
        return self.childNeuron.getOutput()

    def getParentNeuron(self):
        return self.parentNeuron

    def getChildNeuron(self):
        return self.childNeuron

    def getParentOutput(self):
        """Deprecated, not to be used anymore outputs are pushed
never retrieved"""
        return self.parentNeuron.getOutput()

    def isReady(self):
        return self.ready

    def getSignal(self):
        """Signal is coefficient*parentOutput
ans is calculated when received from parent"""
        self.ready=False
        return self.signal

    def __str__(self):
        return "%i :%s - %s (%i)" %(self.id,self.parentNeuron,self.childNeuron,self.coefficient)
